<!DOCTYPE html>
<html lang="zh-CN"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>个人中心</title>
    <meta name="keywords" content="个人中心"/>
    <meta name="description" content="个人中心"/>
    <meta name="viewport"
          content="width=device-width,initial-scale=1, maximum-scale=1,minimum-scale=1, user-scalable=no">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="format-detection" content="telephone=no"/>
    <meta name="viewport" content="width=device-width,viewport-fit=cover">
    <link th:href="@{/shoppingApi/css/weui.min.css}" rel="stylesheet">
    <link th:href="@{/shoppingApi/css/jquery-weui.min.css}" rel="stylesheet">
    <link th:href="@{/shoppingApi/css/public.css}" rel="stylesheet">
    <link th:href="@{/shoppingApi/css/usercenter.css}" rel="stylesheet">
    <meta name="_csrf" th:content="${_csrf.token}"/>
    <meta name="_csrf_header" th:content="${_csrf.headerName}"/>
    <style>
        .weui-actionsheet__menu {
            height: 136px;
            overflow: auto;
        }

        .weui-actionsheet__cell {
            font-size: 14px;
            padding: 6px 0;
        }
    </style>
</head>
<body>
<div class="main usercenter">
    <div class="main_con c323232">
        <div class="rela">
            <img class="w100" src="/shoppingApi/images/userbg.png">
            <div class="abs title flex flex-ac pl15 pr15" style="align-items:end;height:auto;top:50%;margin-top:-52px;">
                <span class="rela">
                    <img class="userpic mr15" src="/shoppingApi/images/userpic.png">
                    <span class="name abs" th:if="${map!=null}" th:text="${map.userRank.rankname}"></span>
                </span>
                <div>
                    <p class="ft14 cfff000 mb5 ml10"><i>用户昵称：</i><i class="userNo" th:if="${map!=null}" th:text="${map.userNo.name}"></i><i class="userNo" th:if="${map==null}">--</i>
                    </p>
                    <p class="ft14 cfff000 mb5 ml10"><i>用户编号：</i><i id="userNo" class="userNo" th:if="${map!=null}"
                                                                    th:text="${map.userNo.userNo}"></i></p>
                    <input type="hidden" id="userNoId" name="useNoId" th:if="${map!=null && map.userNo!=null}" th:value="${map.userNo.id}">
                    <p class="rela">
                        <!--<span class="ft17 cfff bold" th:if="${map!=null}" th:text="${map.userNo.name}"></span>-->
                        <span id="show-actions" class="ft12 cfff changuser ml10"
                              th:if="${#lists.size(map.userNoList)>1}">切换账号</span>
                        <!--<span class="account abs ftc cfff ft15" style="display: none">-->
                        <!--<span th:data="${model.userId}" th:each="model:${user.userNoList}" th:text="${model.userNo}"></span>-->
                        <!--<span id="show-actions">添加账号＋</span>-->
                        <!--</span>-->
                    </p>
                </div>
                <span class="abs usermess" style="right:60px;top:-30px;">
                    <a th:href="${'/wap/accountsetting?userNo='+map.userNo.userNo}"><img style="width:26px;" src="/shoppingApi/images/setting-icon.png"></a>
                </span>
                <span class="abs usermess" style="top:-30px;">
                    <a th:href="@{'/wap/getSysMessage'}"><img src="/shoppingApi/images/mess-white.png"></a>
                    <span class="num abs ft12 message-count">4</span>
                    <!--th:if="${user!=null}" th:text="${user.sysMessageListSize}"-->
                </span>
            </div>
        </div>

        <div class="card ml10 mr10 bgfff">
            <p class="title pl15 pr15 rela">
                <span class="ft15 c323232 bold">全部订单</span>
                <a class="fr" th:href="@{'/wap/getOrderList?orderStatus='+0}">
                    <span class="ft14 c969696 arrow mr10">查看全部</span>
                </a>
            </p>
            <ul class="flex pt15 pb15 ftc ft14 w100">
                <li class="it1 active">
                    <a class="db" th:href="@{'/wap/getOrderList?orderStatus=701'}">
                        <img src="/shoppingApi/images/user1.png">
                        <p>待付款</p>
                    </a>
                </li>
                <li class="it1">
                    <a class="db" th:href="@{'/wap/getOrderList?orderStatus=702'}">
                        <img src="/shoppingApi/images/user2.png">
                        <p>待发货</p>
                    </a>
                </li>
                <li class="it1">
                    <a class="db" th:href="@{'/wap/getOrderList?orderStatus=703'}">
                        <img src="/shoppingApi/images/user3.png">
                        <p>待收货</p>
                    </a>
                </li>
                <li class="it1">
                    <a class="db" th:href="@{'/wap/getOrderList?orderStatus=704'}">
                        <img src="/shoppingApi/images/user4.png">
                        <p>待评价</p>
                    </a>
                </li>
            </ul>
        </div>

        <div class="activity-banner mb15" style="margin: 15px 10px;">
            <a th:href="@{'/wap/visitToStore'}">
            <!--<a href="#">-->
                <img th:src="@{'http://xlspic.ycsqd.com/visit-banner.jpg'}"  alt="">
            </a>
        </div>

        <ul class="cardtwo flex flex-ac ftc ft14 c323232 bgfff mt15 mb15 pt15" style="margin: 15px 10px;">
            <li class="it1">
                <a class="db" th:href="@{'/wap/earnings?type=1&days=1'}">
                    <p><span class="nft10  ">￥</span><span class="day-earnings">0.00</span></p>
                    <p class="rela">今日收益<span></span></p>
                </a>
            </li>
            <li class="it1">
                <a class="db" th:href="@{'/wap/earnings?type=2&days=7'}">
                    <p><span class="nft10">￥</span><span class="week-earnings">0.00</span></p>
                    <p class="rela">本周收益<span></span></p>
                </a>
            </li>
            <li class="it1">
                <a class="db" th:href="@{'/wap/earnings?type=3&days=30'}">
                    <p><span class="nft10">￥</span><span class="month-earnings">0.00</span></p>
                    <p class="rela">本月收益<span></span></p>
                </a>
            </li>

            <li class="it1 mywallets">
                <p>
                    <img src="/shoppingApi/images/user5.png">
                </p>
                <p>我的钱包</p>
            </li>
        </ul>

        <!--活动销售数据-->
        <style>
            .activity-banner { position: relative; }
            .activity-banner img { display: block; width: 100%; }
            .activity-banner span { position: absolute; top: 0; right: 0; padding: 3px 10px; color: #fff; background-color: #f98327; font-size: 12px; }
        </style>
        <!--<div class="activity-banner mb15" style="margin: 15px 10px;">-->
            <!--<a th:href="@{'/wap/activity?productId=491&guigeId=354'}">-->
                <!--<img src="/shoppingApi/images/activity-banner.png" alt="">-->
            <!--</a>-->
            <!--<a class="db" th:href="@{'/wap/myactivity'}">-->
            <!--<span th:text="${'我的销售：'+map.activityUserNoSum}"></span>-->
            <!--</a>-->
        <!--</div>-->

        <div class="yun c323232 bgfff pl15 pr15 mb15" style="margin: 15px 10px;">
            <p class="title ft15 bold">我的云库</p>
            <ul class="flex pt15 pb15 ftc flex-wrap ft14 c323232">
                <li id="myrecord">
                    <img src="/shoppingApi/images/userpic1.png">

                    <p>我的分享</p>



                </li>
                <li id="goodscollect">
                    <img src="/shoppingApi/images/userpic2.png">
                    <p>商品收藏</p>
                </li>
                <li id="mycomment">
                    <img src="/shoppingApi/images/userpic3.png">
                    <p>我的评价</p>
                </li>
                <li id="myaddress">
                    <img src="/shoppingApi/images/userpic4.png">
                    <p>地址管理</p>
                </li>
                <li id="accountseting">
                    <img src="/shoppingApi/images/userpic5.png">
                    <p>账户设置</p>
                </li>
                <li id="severcentter">
                    <a class="db" href="#">
                        <img src="/shoppingApi/images/userpic6.png">
                        <p>客服中心</p>
                    </a>
                </li>
            </ul>
        </div>
        <div class="fixedBox50"></div>
    </div>
</div>
<!--我的业绩-->
<div class="profits" th:if="${map.userNo!=null&&map.userNo.agent==1}">
    <a class="button" href="javascript:openProfits();">业绩<span>&#187</span></a>
    <ul class="flex flex-ac">
        <li>
            今日:<span class="day-oprator-cost">0.00</span>
        </li>
        <li>
            本周:<span class="week-oprator-cost">0.00</span>
        </li>
        <li>
            本月:<span class="month-oprator-cost">0.00</span>
        </li>
    </ul>
    <a class="close" href="javascript:closeProfits();">&#10005</a>
</div>
<!--/我的业绩-->
<!--底部导航 s-->
<div class="fixedBox50 fixed-bottom" style="right:0;left:0;margin:0 auto;">
    <ul class="bottom flex flex-pc ftc bgfff nft10 c323232">
        <li class="it1">
            <a th:href="@{'/wap/productIndex'}" class="db">
                <span class="img"></span>
                <span>首页</span>
            </a>
        </li>
        <li class="it1">
            <a th:href="@{'/wap/selectProductYJAndRjClassfy'}" class="db">
                <span class="img"></span>
                <span>分类</span>
            </a>
        </li>
        <li class="it1">
            <a th:href="@{'/wap/getCartList'}" class="db">
                <span class="img"></span>
                <span>购物车</span>
            </a>
        </li>
        <li class="it1 active db">
            <a>
                <span class="img"></span>
                <span>我的</span>
            </a>
        </li>
    </ul>
</div>
<!--底部导航 e-->
<div class="weui-mask weui-actions_mask"></div>
<div class="weui-actionsheet" id="weui-actionsheet">
    <div class="weui-actionsheet__title"><p class="weui-actionsheet__title-text">选择账号</p></div>
    <div class="weui-actionsheet__menu" style="max-height: 136px;">
        <div class="weui-actionsheet__cell change" th:if="${map!=null&&map.userNoList!=null}"
             th:data="${userNos.userId}" th:type="${map.type}" th:each="userNos:${map.userNoList}"
             th:text="${userNos.userNo}">

        </div>
        <!--th:if="${model!=null}" th:data="${model.userId}" th:type="${user.user.loginType}" th:each="model:${user.userNoList}" th:text="${model.userNo}"-->
    </div>
    <div class="weui-actionsheet__action">
        <!--<div class="weui-actionsheet__cell  color-warning">添加账号+</div>-->
        <!-- th:if="${model!=null}"  th:type="${user.user.loginType}"-->
        <div class="weui-actionsheet__cell weui-actionsheet_cancel">取消</div>
    </div>
</div>
</body>
<script th:src="@{/shoppingApi/js/jquery-3.3.1.min.js}"></script>
<script th:src="@{/shoppingApi/js/jquery-weui.min.js}"></script>
<script th:src="@{/shoppingApi/js/common.js}"></script>

<script type="application/javascript">
    $("#myrecord").on('click', function () {
        window.location.href = "/wap/myrecommend";
    });
    $("#goodscollect").on('click', function () {
        window.location.href = "/wap/productcollect";
    });
    $("#mycomment").on('click', function () {
        window.location = "/wap/mycomment";

    });
    //我的钱包
    $('.mywallets').on('click', function () {
        var userNo = $('#userNo').html();
        window.location.href = "/wap/mywallet?userNo=" + userNo;
    })

    $("#myaddress").on('click', function () {
        window.location = "/wap/myAddress";
    });
    $("#accountseting").on('click', function () {
        var userNo = $('#userNo').html();
        window.location = "/wap/accountsetting?userNo=" + userNo;
    });
    $("#severcentter").on('click', function () {
        window.location = location;
    });

    $(function () {
        var accountList = $('.weui-actionsheet__menu');
        var accountListLen = accountList.find('div').length;
        accountList.css({
            height: accountListLen * 34
        });

        var targetPoplayer = $('.weui-actionsheet');
        $("#show-actions").on("click", function () {
            targetPoplayer.addClass('weui-actionsheet_toggle');
            $('.weui-mask').addClass('weui-mask--visible');
        });

        $('.weui-actionsheet_cancel, .weui-mask').on("click", function () {
            targetPoplayer.removeClass('weui-actionsheet_toggle');
            $('.weui-mask').removeClass('weui-mask--visible');
        });
    });

    $(".change").on('click', function () {
        var type = $.trim($(this).attr('type'));//0密码
        if(type==""){
            type=0;
        }
        if(type==0){
            window.location.href = "/wap/ChangeUserNo?userId=" + $(this).attr('data') + "&userNo=" + $(this).html()+"&type="+type;
        }else {
            $.ajax({
                url: "/wap/ChangeUserNo1?userNo=" + $(this).html(),
                success:function (res) {
                    if(res>0){
                        window.location.href="/wap/openUserCenter";
                    }else {
                        $.toast("切换失败!",1000, function() {
                            window.location.href="/wap/openUserCenter";
                        });
                    }
                }
            })
        }
    });
    /*用户收益*/
    $(function () {
        userShareEaring();//收益
        //业绩
        if ($('.profits').length > 0) {
           flags= getUserNoAchievement();
            userOpratorCost();


        }

    });

    function openProfits () {
        $('.profits').addClass('active');
    }
    function closeProfits () {
        $('.profits').removeClass('active');
    }


    function userShareEaring(){
        var userNoId=$('#userNoId').val();
        if(userNoId==null){//未登录
            //用户未登录，收益显示为0.00
            $('.day-earnings').html("0.00");
            return;
        }
//用户已经登录--显示收益
        $.ajax({
            url:'/wap/sharerEaring?userNoId='+userNoId
            ,success:function (res) {
                if(res.msg=='1'){
                    $('.day-earnings').html(res.dayShareEaringMoney.toFixed(2));
                    $('.week-earnings').html(res.weekShareEaringMoney.toFixed(2));
                    $('.month-earnings').html(res.monthShareEaringMoney.toFixed(2));
                    return;
                }else{
                    $('.day-earnings').html("0.00");
                }

            }
        })

    }

    $(".color-warning").on('click', function () {
        var type = $(this).attr('type');

          type = 2;
        if (type == 1) {
            window.location = "/wap/ChangeUserNo?userId=" + $(this).attr('data') + "&userNo=" + $(this).html();
        }
    });

//用户业绩
function userOpratorCost() {
    var userNoId=$('#userNoId').val();
        $.ajax({
            url:'/wap/getUserNoOprator?userNoId='+userNoId,
            success:function (res) {
                if(res.msg=='1'){
                    $('.day-oprator-cost').html(parseFloat(res.userNo.orderOpratorcost).toFixed(2));
                    $('.week-oprator-cost').html(parseFloat(res.userNo.weekOpratorcost).toFixed(2));
                    $('.month-oprator-cost').html(parseFloat(res.userNo.monthOpratorcost).toFixed(2));
                }
            }
        })
}
var flags=false;
function getUserNoAchievement() {
    $.ajax({
        async:false,
        url:'/getUserNoAchievement?type=1'
        ,success:function (res) {
                if(res.msg=='1'){
                    flags=true;
                }
        }
    })
    return flags;
}

</script>
</html>